package cn.tedu.tmall.admin.mall.schedule;

import cn.tedu.tmall.admin.mall.service.ICategoryService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
@Slf4j
public class CategoryCacheSchedule {

    @Autowired
    private ICategoryService categoryService;

    // 秒 时 分 日 月 周
    // cron = ""
    // fixedDelay：执行间隔
    // fixedRate：执行频率
    @Scheduled(fixedDelay = 300000)
    public void rebuildCache(){
        log.info("CategoryCacheSchedule.rebuildCache()::start...");
        categoryService.rebuildCache();
        log.info("CategoryCacheSchedule.rebuildCache()::finish...");
    }

}
